<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Javabb工具箱</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>

</head>
<body>
<div class="container">
    <div class="row">
        <div class="panel panel-primary">
            <div class="panel-heading">百度网盘目录读取</div>
            <div class="panel-body">
                <div class="row" style="margin-bottom: 20px;">
                    <div class="col-lg-1">
                        层级：
                        <select class="form-control" id="level">
                            <option value="3">3</option>
                            <option value="5">5</option>
                            <option value="8">8</option>
                        </select>
                    </div>
                    <div class="col-lg-6">
                        目录标题：
                        <div class="input-group">
                            <input type="text" id="menuName" class="form-control" placeholder="Search for...">
                            <span class="input-group-btn">
                        <button class="btn btn-default" type="button" onclick="readMenu();"> 读取 </button>
                      </span>
                        </div><!-- /input-group -->
                    </div>
                </div>
                目录文本：
                <div class="row" style="margin-top: 30px;">
                    <div class="col-lg-9">
                        <textarea id="menuText" class="form-control" rows="12" aria-multiline="true"></textarea>
                    </div>
                </div>
                <div class="row" style="margin-top: 30px;">
                    <div class="col-lg-9">
                        <button type="button" onclick="copy();" class="btn btn-success">复制</button>
                    </div>
                </div>
            </div>
        </div>

        <!--<div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Panel title</h3>
            </div>
            <div class="panel-body">
                Panel content
            </div>
        </div>-->
    </div>
</div>

<script type="text/javascript">
    $(function () {
    });
    function copy() {
        $('#menuText').select();
        document.execCommand("copy");
        alert("复制成功");
    }
    function readMenu() {
        var menuName = $('#menuName').val();
        var level = $('#level').val();
        $('#menuText').val("");
        if(menuName==""){
            alert("读取目录不能为空！");
            return;
        }
        $.post("/pan/read",{menuName:menuName,level:level},function(result){
            if(result.success){
                $('#menuText').val(result.data);
            }
        },"json");

    }
</script>

</body>
</html>